package com.yx.yinshanjinniu.adapters;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.yx.yinshanjinniu.R;
import com.yx.yinshanjinniu.base.BaseRVAdapter;
import com.yx.yinshanjinniu.base.BaseRVHolder;
import com.yx.yinshanjinniu.bean.HomeHotBean;
import com.yx.yinshanjinniu.utils.StringUtil;

import java.util.List;

public class HotArticleAdapter extends BaseRVAdapter<HomeHotBean> {
    private int selectedPosition = 0;

    public HotArticleAdapter(Context context, List<HomeHotBean> list) {
        super(context, list);
    }

    @Override
    public int onCreateViewLayoutID(int viewType) {
        return R.layout.item_hot_current;
    }

    @Override
    public void onBindView(BaseRVHolder holder, int position) {
        HomeHotBean homeHotBean = mList.get(position);
        View view_first = holder.getViewHolder().get(R.id.view_first);
        TextView tv_time = holder.getViewHolder().get(R.id.tv_time);
        TextView tv_content = holder.getViewHolder().get(R.id.tv_content);
        if (position == 0){
            view_first.setVisibility(View.INVISIBLE);
        }else {
            view_first.setVisibility(View.VISIBLE);
        }
        tv_time.setText(homeHotBean.time);
        tv_content.setText(StringUtil.isEmpty(homeHotBean.data.content) ? "暂无内容" : homeHotBean.data.content);
    }

}
